﻿using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using Microsoft.Toolkit.Mvvm.Messaging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace _07_02_Microsoft.Toolkit框架
{
	public class RedefineProperty : ObservableObject
	{
	public RedefineProperty() 
		{
			Name= "Name";
			ShowCommand = new RelayCommand<string>(Show);
		
		}
		public RelayCommand<string> ShowCommand { get;  }


		private string name;
		public string Name
		{
			get { return name; }
			set
			{
				name = value;
				OnPropertyChanged();
			}
		}


		private int age;
		public int Age
		{
			get { return age; }
			set
			{
				age = value;
				OnPropertyChanged();
			}
		}

		public void Show(string content)
		{
			name = "点击了按钮2";
			Age = 999;

			//我给Token1的地址发送了一个string类型的值  content
			WeakReferenceMessenger.Default.Send(content,"Token1");
		}

	}
}
